package io.renren.modules.workmanagement.controller;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.sys.controller.AbstractController;
import io.renren.modules.workmanagement.entity.QuestionBankCourseRelEntity;
import io.renren.modules.workmanagement.service.QuestionBankCourseRelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 *
 *
 * @author yewei
 * @email sunlightcs@gmail.com
 * @date 2022-04-26 01:12:33
 */
@RestController
@RequestMapping("workmanagement/questionbankcourserel")
public class QuestionBankCourseRelController extends AbstractController {
    @Autowired
    private QuestionBankCourseRelService questionBankCourseRelService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = questionBankCourseRelService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
		QuestionBankCourseRelEntity questionBankCourseRel = questionBankCourseRelService.getById(id);

        return R.ok().put("questionBankCourseRel", questionBankCourseRel);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody QuestionBankCourseRelEntity questionBankCourseRel){
		questionBankCourseRelService.save(questionBankCourseRel);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody QuestionBankCourseRelEntity questionBankCourseRel){
		questionBankCourseRelService.updateById(questionBankCourseRel);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
		questionBankCourseRelService.removeByIds(Arrays.asList(ids));
        return R.ok();
    }

}
